# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
File    : qt_message.py
Time    : 2023/8/28 16:00
author  : mojin
Email   : 397135766@qq.com
-------------------------------------------------------------------------------
"""
from datetime import datetime

def message( QtWidgets,title, content, fun='about'):
    # QtWidgets.QCheckBox
    if fun == "information":
        ##消息正文
        QtWidgets.QMessageBox.information(None, title, content, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                                          QtWidgets.QMessageBox.Yes)

    elif fun == "question":
        # 问答消息正文
        QtWidgets.QMessageBox.question(None, content, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                                       QtWidgets.QMessageBox.Yes)

    elif fun == "warning":
        # 警告消息正文
        QtWidgets.QMessageBox.warning(None, title, content, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                                      QtWidgets.QMessageBox.Yes)

    elif fun == "critical":
        # 严重错误消息正文
        QtWidgets.QMessageBox.critical(None, title, content, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                                       QtWidgets.QMessageBox.Yes)

    elif fun == "about":
        # 关于消息正文
        QtWidgets.QMessageBox.about(None, title, content)

def log( textEdit,message,mmodule=''):
    current_time = datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")

    textEdit.append(f"{current_time}--[{mmodule}]--{message}")